Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deterministic TagPair assertion of custom registry #1183

Merged
merged 2 commits into from
Nov 4, 2020
Merged

Deterministic TagPair assertion of custom registry #1183

merged 2 commits into from
Nov 4, 2020

Conversation

wilsonehusin
Copy link
Contributor

This ensures that we are testing images which were overriden by custom
registry. Some registries are meant to be excluded from override.

See #1181 for details.

Signed-off-by: Wilson E. Husin whusin@vmware.com

What this PR does / why we need it:
Stabilizes unit tests flake

Which issue(s) this PR fixes

Special notes for your reviewer:

Release note:

NONE

Copy link
Contributor

@vladimirvivien vladimirvivien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will admit, that part of the code is murky to me. But, left some comments anyway.

// As a sample, check one of the images for E2E and assert their mapping
var e2eImageTagPair TagPair
for _, imageTagPair := range imageTagPairs {
if strings.Contains(imageTagPair.Src, "e2e") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this ensures the name of the image:tag contains e2e in the string ? Is that always the case ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this ensures that what we validate is only the e2e in string, which should scope to gcr.io/kubernetes-e2e-test-images or k8s.gcr.io/e2e-test-images -- both are overridable with custom registry

}
}

if strings.HasPrefix(e2eImageTagPair.Src, customRegistry) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if that loop never break (above) does that create any initializiation hazard for var e2eImageTagPair? It does not seem like it (since e2eimagetagpair is a struct) but check please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah that's a good point. I think e2e will always exist, but I also think it's valuable to have check to assert it.

Wilson E. Husin added 2 commits November 3, 2020 12:11
This ensures that we are testing images which were overriden by custom
registry. Some registries are meant to be excluded from override.

See #1181 for details.

Signed-off-by: Wilson E. Husin <whusin@vmware.com>
Signed-off-by: Wilson E. Husin <whusin@vmware.com>
Copy link
Contributor

@vladimirvivien vladimirvivien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wilsonehusin wilsonehusin merged commit be8c386 into vmware-tanzu:master Nov 4, 2020
@wilsonehusin wilsonehusin deleted the deterministic-assertion-for-custom-registry branch November 4, 2020 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent unit test result
2 participants